<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserPermissionsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_permissions', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('group_id')->comment('分类ID');
            $table->string('title')->comment('权限名称');
            $table->string('description')->nullable()->comment('权限描述');
            $table->string('slug', 50)->comment('简称');
            $table->string('http_method', 50)->comment('方法');
            $table->string('http_path')->nullable()->comment('路径');
            $table->unsignedTinyInteger('is_enabled')->default(0)->comment('是否禁用，0:手动分配,1:默认分配');
            $table->string('data_scope')->nullable()->comment('数据域');
            $table->timestamps();

            $table->comment = '用户权限表';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_permissions');
    }

}
